<!DOCTYPE html>
<html>
<?php echo $this->fetch('head.html'); ?>
<body>
<div class="header" >
  <div class="title"><?php if ($this->_var['field'] == 'money'): ?>营业额<?php else: ?>订单<?php endif; ?>统计</div>
 </div>
<?php echo $this->fetch('stat/nav.html'); ?>

<form method="get" class="row searchform">
	<input type="hidden" name="m" value="stat_shoporder_day">
   <input type="hidden" name="a" value="all">
  <div class="l160">
    <div class="input-row">
      <label>开始</label>
      <input type="text" value="<?php echo $_GET['startday']; ?>" name="startday" onClick="WdatePicker({dateFmt:'yyyyMMdd'})">
    </div>
  </div>
  <div class="l160">
    <div class="input-row">
      <label>结束</label>
      <input type="text" value="<?php echo $_GET['endday']; ?>" name="endday" onClick="WdatePicker({dateFmt:'yyyyMMdd'})">
    </div>
  </div>
  <div class="l60">
    <button type="submit" class="btn btn-row">查询</button>
  </div>
</form>
<div class="pd-10">总计营业额<?php echo intval($this->_var['total_money']); ?><?php if ($this->_var['field'] == 'money'): ?>元<?php else: ?>单<?php endif; ?></div>
<div class="index-hd">统计图</div>
 <div style="width:90%; max-width:640px; margin:0 auto;"><canvas id="canvas" height="450" width="600" style="width:100%" ></canvas></div>
 <div class="index-hd">详细列表</div>
<div class="uclist"> <?php $_from = $this->_var['list']; if (!is_array($_from) && !is_object($_from)) { $_from=array();}; $this->push_vars('', 'c');if (count($_from)):
    foreach ($_from AS $this->_var['c']):
?>
  <div class="item">
  <?php if ($this->_var['field'] == 'money'): ?>
    <div class="content pd-5"><?php echo $this->_var['c']['kday']; ?>  营业额￥<span class="money"><?php echo $this->_var['c']['money']; ?></span>元</div>
    <?php else: ?>
     <div class="content pd-5"><?php echo $this->_var['c']['kday']; ?> 成功订单数<span class="money"><?php echo $this->_var['c']['ordernum']; ?></span>单</div>
    <?php endif; ?>
  </div>
  <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> </div>
<div><?php echo $this->_var['pagelist']; ?></div>
<?php echo $this->fetch('footer.html'); ?>
 <script src="/plugin/chart/Chart.min.js"></script>
  <script>
		var randomScalingFactor = function(){return Math.round(Math.random()*100)};
		var lineChartData = {
			labels : [<?php echo $this->_var['labels']; ?>],
			datasets : [
				{
					label: "My First dataset",
					fillColor : "rgba(220,220,220,0.2)",
					strokeColor : "rgba(220,220,220,1)",
					pointColor : "rgba(220,220,220,1)",
					pointStrokeColor : "#fff",
					pointHighlightFill : "#fff",
					pointHighlightStroke : "rgba(220,220,220,1)",
					data : [<?php echo $this->_var['moneys']; ?>]
				} 
			]

		}

	window.onload = function(){
		var ctx = document.getElementById("canvas").getContext("2d");
		window.myLine = new Chart(ctx).Line(lineChartData, {
			responsive: true
		});
	}


	</script>
<script language="javascript" src="/plugin/My97DatePicker/WdatePicker.js"></script>
</div>
</body>
</html>